<template>
    <el-tabs v-model="activeTab">
        <el-tab-pane label="帐号" name="account">
            <account :usage="2"></account>
        </el-tab-pane>
        <el-tab-pane :lazy=true label="提示语" name="promotion">
            <PromotionList></PromotionList>
        </el-tab-pane>
        <el-tab-pane :lazy=true label="生成规则" name="coderule">
            <AiRuleList></AiRuleList>
        </el-tab-pane>
        <el-tab-pane :lazy=true label="生成任务" name="platform">
            <TaskGroup :usage="2"></TaskGroup>
        </el-tab-pane>
        <el-tab-pane :lazy=true label="生成计划" name="job">
            <AiJobList></AiJobList>
        </el-tab-pane>
        <el-tab-pane :lazy=true label="生成数据" name="jobdata">
            <Article @handleRow="handleCrawle" :statusBtns="statusBtns" buttonName="生成"></Article>
        </el-tab-pane>
    </el-tabs>
</template>

<script>
const { ipcRenderer: ipc } = require('electron')
import { UsageScope } from "@/entities/Constant"
import AiJobList from "./ai/aiJobList"
import AiRuleList from "./ai/aiRuleList"
import PromotionList from "./ai/promotionList"
import Account from "@/views/media/common/Account"
import Article from "@/views/media/common/Article"
import TaskGroup from "@/views/media/common/TaskGroup"
export default {
    name: "Ai",
    components: {
        Account,
        Article,
        TaskGroup,
        AiJobList,
        AiRuleList,
        PromotionList
    },
    data() {
        return {
            activeTab: "account",
            statusBtns: [
                { status: -1, name: "全部" },
                { status: 1, name: "已采集" },
                { status: 2, name: "已生成" }],
        }
    },
    methods: {
        handleCrawle(row) {
            console.log("handleRow", row)
            ipc.send("puppeteer", { usageScope: UsageScope.Ai, data: row, raw: 1 })
        }
    },
    filters: {
    },
}
</script>